package com.docking.heylo;

import com.docking.heylo.pojo.Request;

import java.util.Locale;

public class ThreadContext {

    public static ThreadLocal<Request> authorize = new ThreadLocal<>();

    /***
     * 获取当前登录用户的ID
     *
     * @return
     */
    public static int userId(){
        return authorize.get().getUser().getUserId();
    }

    /***
     * 获取用户资料ID
     *
     * @return
     */
    public static Integer informationId() {
        return authorize.get().getUser().getUserId();
    }

    /***
     * 获取用户身份类型
     *
     * @return
     */
    public static Integer type(){
        return authorize.get().getUser().getType();
    }

    /***
     * 获取交友模式
     * @return
     */
    public static Integer apertureMode(){
        return authorize.get().getUser().getApertureMode();
    }

    /***
     * 获取用户语言
     *
     * @return
     */
    public static Locale locale(){
        return authorize.get().getLocale();
    }

    /***
     * 获取登录IP
     *
     * @return
     */
    public static String ip() {
        return authorize.get().getIp();
    }

    /**
     * 是否是大A
     *
     * @return
     */
    public static boolean bigA(){
        return authorize.get().getUser().getV() == 1 ? true : false;
    }


    public static int showModel(){
        return authorize.get().getUser().getShowModel();
    }


}
